]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspacesView/workspacesDisplay: Scroll on horizontal layouts
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 2 Jan 2021 20:56:57 +0000 (17:56 -0300)
committerMarge Bot <marge-bot@gnome.org>
Thu, 28 Jan 2021 15:11:56 +0000 (15:11 +0000)
WokspacesDisplay simply remaps the scroll direction into the next
workspace, but that doesn't account for the new horizontal layout.

Scroll horizontally on horizontal layouts when scroll direction is
on the vertical axis.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1603>

js/ui/workspacesView.js

index 12f5ca3a81ed7074224708ad1b09c242c0672dfe..8fc21c40df36aa6eb91bab4fb5edaf830462d8f7 100644 (file)
@@ -772,14 +772,21 @@ class WorkspacesDisplay extends St.Widget {
             return Clutter.EVENT_PROPAGATE;
 
         let workspaceManager = global.workspace_manager;
+        const vertical = workspaceManager.layout_rows === -1;
         let activeWs = workspaceManager.get_active_workspace();
         let ws;
         switch (event.get_scroll_direction()) {
         case Clutter.ScrollDirection.UP:
-            ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
+            if (vertical)
+                ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
+            else
+                ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
             break;
         case Clutter.ScrollDirection.DOWN:
-            ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
+            if (vertical)
+                ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
+            else
+                ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
             break;
         case Clutter.ScrollDirection.LEFT:
             ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);